package com.cam.iot.factor.info.pojo.wrapper;

import com.cam.iot.factor.info.pojo.dto.IotFactorDTO;
import com.cam.iot.factor.info.pojo.entity.IotFactor;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface IotFactorWrapper {

    @Mappings({
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")
    })
    IotFactorDTO toDTO(IotFactor entity);

    @Mappings({
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")
    })
    IotFactor toEntity(IotFactorDTO dto);

}
